<%@ include file="/common/taglibs.jsp"%>
<head>
	<title><fmt:message key="shopcarlist.title" />
	</title>
	<script type="text/javascript"
		src="<c:url value='/ext/scripts/product/product.js'/>">
</script>
</head>

<div class="box_big" style="padding-top:5px;">
<div class="ceng_mar5" style="padding-bottom:5px;">
<c:if test="${form eq 'product'}">
	<form:form commandName="shopinfo"
		action="${ctx}/shopcar/shopcar.html?method=saveorupdate" method="post">
		<form:hidden path="orderid" />
		<input type="hidden" name="tz" value="${tzpage}"/>
		<input type="hidden" name="pagename" value="${pagename}"/>
		<input type="hidden" name="operate" value="${form}"/>
		<table width="100%" class="table_cx" border="0" cellspacing="0" cellpadding="0">
			
			<div class="table_box">
        	<div class="biao">
            	<h6><p><font><fmt:message key="shopcar.baseinfo"/></font></p></h6>
                <span></span>
            </div>
            </div>
			
			<tr onmouseover="this.className='red'" onmouseout="this.className=''">
				<td class="first right">
					<fmt:message key="shopcar.priority" />
				</td>
				<td class="left">
					<form:select path="priority">
						<option value=""><fmt:message key="common.pleaseselect"/></option>
						<c:forEach var="b" items="${prioitymap}">
							<form:option value="${b.key}">${b.value}</form:option>
						</c:forEach>
					</form:select>
				</td>
				<td class="right">
					<fmt:message key="shopcar.ordermediumid" />
				</td>
				<td class="left">
					<form:select path="ordermediumid">
						<option value=""><fmt:message key="common.pleaseselect"/></option>
						<c:forEach var="b" items="${ordermediumidmap}">
							<form:option value="${b.key}">${b.value}</form:option>
						</c:forEach>
					</form:select>
				</td><%--
				<td class="right">
					<fmt:message key="shopcar.bandsordered" />
				</td>
				<td class="left">
					<c:forEach var="b" items="${bandsorderedlist}">
					${b}<form:checkbox path="bandsordered" value="${b}" />
					</c:forEach>
				</td>
			--%></tr>
			<tr class="hui" onmouseover="this.className='red'" onmouseout="this.className='hui'">
				<td class="first right">
					<fmt:message key="shopcar.notsave" />
				</td>
				<td class="left">
					<input type="radio" name="savemodel" value="3" checked="checked"/>
				</td>
				<td class="right">
					<fmt:message key="shopcar.savemodel" />
				</td>
				<td class="left">
					<input type="radio" name="savemodel" value="1" />
				</td>
				<td class="right">
					<fmt:message key="shopcar.savedefaultmodel" />
				</td>
				<td class="left">
					<input type="radio" name="savemodel" value="2" />
				</td>
			</tr>
		</table>
		<table>
			<tr>
				<td>
					<input type="button"
						value="<fmt:message key="shopcar.returnshopcar"/>"
						onclick="javascript:location.href='${ctx}/shopcar/shopcar.html?method=query'" class="btn_blue2"/>
					<input type="submit" value="<fmt:message key="button.update"/>" class="btn_blue2"/>
				</td>
			</tr>
		</table>
	</form:form>
</c:if>
<c:if test="${form eq 'collect'}">
	<form:form commandName="shopinfo" id="satellite" action="${ctx}/shopcar/shopcar.html?method=collect" method="post">
		<input type="hidden" id="sensorlist" value="${shopinfo.sensorid}"/>
		<input type="hidden" name="tz" value="${tzpage}"/>
		<input type="hidden" name="pagename" value="${pagename}"/>
		<form:hidden path="orderid" />
		<table width="100%" class="table_cx" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<th colspan="6"><p class="biao"><fmt:message key="shopcar.baseinfo"/></p></th>
		</tr>
		<c:forEach var="sate" items="${satellitelist}">
			<tr>
				<td colspan="6" align="left">
				${sate}:&nbsp;&nbsp;
					<c:forEach var="varm" items="${map}">
						<c:if test="${varm.key eq sate}">
							<c:forEach var="m" items="${varm.value}">
								<c:set var="sensor" value="${varm.key}_${m}"/>
								<c:set var="selected" value="0"/>
								<c:forEach var="selectsensor" items="${shopinfo.sensorid}">
									<c:if test="${sensor eq selectsensor}"><c:set var="selected" value="1"/>${m}<input type="checkbox" name="sensorid" id="sensorid" value="${varm.key}_${m}" checked="checked"/>&nbsp;</c:if>
								</c:forEach>
								<c:if test="${selected ne 1}">${m}<input type="checkbox" name="sensorid" id="sensorid" value="${varm.key}_${m}"/>&nbsp;</c:if>
							</c:forEach>
						</c:if>
					</c:forEach>
					<br/>
				</td>
			</tr>
		</c:forEach>
			<tr onmouseover="this.className='red'" onmouseout="this.className=''">
				<td class="first right">
					<fmt:message key="shopcar.orderpriority" />
				</td>
				<td class="left">
					<form:select path="priority">
						<c:forEach var="b" items="${prioitymap}">
							<form:option value="${b.key}">${b.value}</form:option>
						</c:forEach>
					</form:select>
				</td>
				<td class="right">
					<fmt:message key="shopcar.receivingstation" />
				</td>
				<td class="left">
					<c:forEach var="rs" items="${receivingstation}">
						${rs}<input type="checkbox" name="receivestationid" value="${rs}" 
						<c:forEach var="crs" items="${receives}">
						<c:if test="${rs eq crs}">checked="checked"</c:if>
						</c:forEach>
						/>
					</c:forEach>
				</td>
				<td class="right"><fmt:message key="shopcar.resolution" /></td>
				<td class="left"><form:input path="gsd"/></td>
			</tr>
			<tr class="hui" onmouseover="this.className='red'" onmouseout="this.className='hui'">
				<td class="first right"><fmt:message key="shopcar.leftuplatlong" /></td>
				<td class="left" colspan="2"><input type="text" id="leftup" name="leftup" value="${shopinfo.upperleftlong},${shopinfo.upperleftlat}"/></td>
				<td class="right"><fmt:message key="shopcar.rightuplatlong" /></td>
				<td class="left" colspan="2"><input type="text" id="rightup" name="rightup" value="${shopinfo.upperrightlong},${shopinfo.upperrightlat}"/></td>
			</tr>
			<tr onmouseover="this.className='red'" onmouseout="this.className=''">
				<td class="first right"><fmt:message key="shopcar.leftdownlatlong" /></td>
				<td class="left" colspan="2"><input type="text" id="leftdown" name="leftdown" value="${shopinfo.lowerleftlong},${shopinfo.lowerleftlat}"/></td>
				<td class="right"><fmt:message key="shopcar.rightdownlatlong" /></td>
				<td class="left" colspan="2"><input type="text" id="rightdown" name="rightdown" value="${shopinfo.lowerrightlong},${shopinfo.lowerrightlat}"/></td>
			</tr>
		</table>
		<table>
			<tr>
				<td>
					<input type="button"
						value="<fmt:message key="shopcar.returnshopcar"/>"
						onclick="javascript:location.href='${ctx}/shopcar/shopcar.html?method=query'"  class="btn_blue2"/>
					<input type="submit" value="<fmt:message key="button.update"/>"  class="btn_blue2"/>
				</td>
			</tr>
		</table>
	</form:form>
<script type="text/javascript">
jQuery(function () {
    var sensors = jQuery("#sensorlist").val();
	jQuery.post("shopcar.html?method=satellite",{sensorlist:sensors},function(data){
		try {
			jQuery.each(data.ingredients,function(idx,item){ 
				var str = jQuery("#satellite>input[id='"+item+"']");
				str.attr("checked","checked");
			if(idx==0){
				 return true;    
			}      
			});  
		} catch(e)
		{
			alert("Error in XML response:"+e);  
		}  
	},'JSON');


});
</script>
</c:if>
</div>
</div>